﻿namespace CasbinABACDemo
{
    public class Env
    {
        public string Role { set; get; }

        public string Operation { set; get; }

        public string Time { set; get; }
    }

    public static class EnvExtensions
    {
        //添加自定义函数
        public static bool IsTime(this Env env)
            => env.Time.ToString().Equals("1");

        public static string ConvertTimeToZeroOne()
        {
            if (DateTime.Now.Hour > 8 && DateTime.Now.Hour < 18) return 1.ToString();
            return 0.ToString();
        }
    }
}